<?php
    include 'mysqlconnect.php';
    $params = array(
        'hostname' => '127.0.0.1',
        'dbname' => 'level',
        'username' => 'root',
        'password' => ''
    );
    $connect = new mysqlconnect($params);
    $connect->connect();
    $id = $_GET['id'];
    if ($id!='')
    {
        $cases = $connect->fetch('SELECT * FROM cases WHERE id=?',$id);
        $next = $connect->fetch('SELECT id next FROM cases WHERE orderid > ? ORDER BY orderid limit 1',$cases[0]['orderid']);
                
        $pre = $connect->fetch('SELECT id pre FROM cases WHERE orderid < ? ORDER BY orderid limit 1',$cases[0]['orderid']);
        $case_images = $connect->fetch('SELECT filename FROM case_image WHERE case_id=?',$id);
        $cases[0]['case_image'] = $case_images;
        $cases[0]['next'] = $next[0]['next'];
        $cases[0]['pre'] = $pre[0]['pre'];
        echo json_encode($cases);
    }
    

?>
